import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import remove from '@dfeidao/atom-web/local/remove';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
// import show_loading from '../../atom-web/show-loading';
// import hide_loading from '../../atom-web/hide-loading';
export default async function a010(fd: IFeidaoAiBrowserComponent) {
	// 删除

	const id = get(fd, 'w_id');

	const prid = get(fd, 'productid');

	if (!id) {
		await error('请选择一条删除数据');
		// fire('zjc-000001', 'ec-001', 'fail', '请选择一条删除数据');
		return;
	} else {
		// show_loading();
		const tab = "tab2";
		// const del_res = await nodejs(url, './permissions/role_type_del1', { id, productid: prid }, false, false);
		const del_res = await nodejs('role-type/zj-000004/s005', { id, productid: prid });
		// hide_loading();
		if (del_res === 'success') {
			success('删除成功');
			// fire('zjc-000001', 'ec-001', 'success', '删除成功');

			remove(fd, 'w_id');
			fire('zj-000004', 'ec-002', tab);

		} else {
			await error('删除失败');
			// fire('zjc-000001', 'ec-001', 'fail', '删除失败');
			return;
		}
	}
}
